"""
Task 其实是Future对象的子类，Task extend future
"""
import asyncio

# future 很少单独用；用task
async def set_after(fut):
    print("begin...")
    await   asyncio.sleep(3)
    fut.set_result("666")

async def main():
    loop = asyncio.get_event_loop()
    fut = loop.create_future()
    loop.create_task(set_after(fut))
    # future,帮我我hang住等待结果
    data = await fut
    print(data)

if __name__ == '__main__':
 asyncio.run(main())